<?php

/*

Searching for Wild Pets (search_for_pets.php)

*/

$rank_check = 1;
$page_title = "Searching for Wild Pets";
include "header.inc.php";

if ($getInfo[premium] == 1) { $price = "300"; } else { $price = "750"; }

$findSearch = fetch("SELECT * FROM search_pets2 WHERE userid = '$userid' AND game = '$game'");
$findSearchForPetRow = fetch("SELECT * FROM search_pets_arrays WHERE game = '$game'");

if ((!$findSearchForPetRow[pets]) OR (!$findSearchForPetRow[items]))
{
	if ($rank == 7)
	{
		$ifAdmin = "<br>Admins: Click <a href=admin/admin_set_searchpets.php?game=$game>here</a> to configure this game!!";
	}

	die("$openHTML<p>This game is not set up right now.$ifAdmin$closeHTML");
}

if ($findSearch[id])
{
	die(header(error("searching_for_pets.php?game=$game","You are already exploring.")));
}

if ($page == "start")
{
	if ($points < $price)
	{
		die(header(error("search_for_pets.php?game=$game","You must have at least $price $pointsVar to explore!")));
	}
	points($game,"$username", "-$price");
	mysql_query("INSERT INTO search_pets2 (userid,direction,game) VALUES ('$userid','right','$game')");
	die(header(error("searching_for_pets.php?game=$game","You may now start exploring!")));
}

print "$openHTML";

if (!$page)
{
	print "<p>Hey, for just a small price of $price $pointsVar you can get 100 moves in our wild area, searching for rare pets! You also get 20 free nets, 10 basic, 5 electric, and 5 magic nets.</p><p align=center>Click <a href=search_for_pets.php?game=$game&page=start>here</a> to pay $price $pointsVar to start your searching!</p>

<p>We now rent out boats for $price $pointsVar and you can try your luck with <a href=fish_for_pets.php?game=$game>fishing</a>!!</p>";

}

print "$closeHTML";

?>